home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / WFC010.ZIP / TEST / TCNETCON.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-24  |  1.4 KB  |  37 lines

  1. #include "test.h"
  2. #pragma hdrstop
  3.  
  4. void test_CNetworkConnections( LPCTSTR machine_name )
  5. {
  6.    CNetworkConnections connections( machine_name );
  7.  
  8.    CNetworkConnectionInformation connection_information;
  9.  
  10.    if ( connections.Enumerate( "data" ) == TRUE )
  11.    {
  12.       printf( "Network Connections Information:\n" );
  13.  
  14.       while( connections.GetNext( connection_information ) == TRUE )
  15.       {
  16.          printf( " ID            - %d\n",               connection_information.ID            );
  17.          printf( " Type          - %d\n",               connection_information.Type          );
  18.          printf( " NumberOfUsers - %d\n",               connection_information.NumberOfUsers );
  19.          printf( " NumberOfOpens - %d\n",               connection_information.NumberOfOpens );
  20.          printf( " Time          - %d\n",               connection_information.Time          );
  21.          printf( " UserName      - \"%s\"\n", (LPCTSTR) connection_information.UserName      );
  22.          printf( " NetName       - \"%s\"\n", (LPCTSTR) connection_information.NetName       );
  23.       }
  24.    }
  25.    else
  26.    {
  27.       DWORD error_code = connections.GetErrorCode();
  28.  
  29.       CString error_message;
  30.  
  31.       Convert_NERR_Code_to_String( error_code, error_message );
  32.  
  33.       printf( "CNetworkConnections.Enumerate( CNetworkConnectionInformation ), ErrorCode == %d \"%s\"\n", error_code, (LPCTSTR) error_message );
  34.    }
  35. }
  36.  
  37.